package com.example.plane;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

import com.example.plane.GameView.GameView;
import com.example.plane.GameView.GameView;

public class GameActivity extends AppCompatActivity {
    private static Context Context = null;
    public Bitmap background;
    public Bitmap plane;
    public Bitmap background2;

   public static WindowManager wm;
   public static int Scrrenwidth;
   public static int Screenheight;
    public static GameActivity instance=null;
    public static Resources resourcesInstance;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        resourcesInstance=this.getResources();
        wm = (WindowManager) this.getSystemService(this.WINDOW_SERVICE);//获取场景以及服务
        init();//初始化屏幕信息
//       background= BitmapFactory.decodeResource(getResources(), R.drawable.qj0);
        GameView ackgroundview= new GameView(this);

//        Display display = windowManager.getDefaultDisplay();

        //Andorid.util 包下的DisplayMetrics 类提供了一种关于显示的通用信息，如显示大小，分辨率和字体
//        DisplayMetrics metrics = new DisplayMetrics();

        //将当前窗口中的一些信息放在DisplayMetrics里面
//        display.getMetrics(metrics);
//        gameView.currX = 0;
        //planeView.currentY = metrics.heightPixels-40;
//        gameView.currY = 0;
        setContentView(ackgroundview);
//        gameView.invalidate();
    }
    public void init()
    {
        Screenheight=wm.getDefaultDisplay().getHeight();
        System.out.println("test"+Screenheight);
        Scrrenwidth=wm.getDefaultDisplay().getWidth();

    }


}
